package com.gy.ai.agent.platform.ollama.entity;

import com.gy.ai.agent.core.ReqOptions;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * @author LGY
 * Create by 2025/6/18 14:43
 */
@Data
@Accessors(chain = true)
public class OllamaChatReq extends ReqOptions implements Serializable {

    private String model;

    private List<Message> messages;

    private List<Tool> tools;

    private Format format;

    private Modelfile options;

    private Boolean stream;

    private String keep_alive;

    @Data
    @Accessors(chain = true)
    public static class Tool implements Serializable {
        private String type;

        private Function function;
    }

    @Data
    @Accessors(chain = true)
    public static class Function implements Serializable {
        private String name;

        private String description;

        private Map<String, Object> parameters;
    }

    @Data
    @Accessors(chain = true)
    public static class Modelfile implements Serializable {

        private Integer mirostat;

        private BigDecimal mirostat_eta;

        private BigDecimal mirostat_tau;

        private Integer num_ctx;

        private Integer repeat_last_n;

        private BigDecimal repeat_penalty;

        private BigDecimal temperature;

        private Integer seed;

        private String stop;

        private Integer num_predict;

        private Integer top_k;

        private BigDecimal top_p;

        private BigDecimal min_p;
    }

    @Data
    @Accessors(chain = true)
    public static class Format implements Serializable {

        private String type;

        private Map<String, Object> properties;
    }

    @Data
    @Accessors(chain = true)
    public static class Message implements Serializable {

        private String role;

        private String content;

        /**
         * 单个图片一样base64形式提供
         */
        private List<String> images;

        private Object tool_calls;
    }
}
